package com.situ.web.service;

import java.util.List;

import com.situ.web.dao.StudentDao;
import com.situ.web.entity.Student;

public class StudentService {
	private StudentDao studentDao = new StudentDao();
	
	public List<Student> findAll() {
		List<Student> list =  studentDao.findAll();
		
		return list;
		
	}

	public boolean deleteById(int id) {
		int count = studentDao.deleteById(id);
		if (count == 1) {
			return true;
		}else {
			return false;
		}
	}

	public boolean InsertStudent(Student student) {
		// TODO Auto-generated method stub
		int count = studentDao.insert(student);
		if (count == 1) {
			return true;
		}else {
			return false;
		}
	}
	
	public Student selectById(int id) {
		Student student = studentDao.selectById(id);
		
		return student;
	}

	public boolean updateStudent(Student student) {
		// TODO Auto-generated method stub
		int count = studentDao.update(student);
		if (count == 1) {
			return  true;
		}else {
			return false;
		}
	}

	
}
